
package modele;

import java.util.Collection;
import java.util.HashSet;
import java.util.TreeSet;


public class Dep implements Comparable<Dep> {
    
    private String num;
     private Collection<Med> lesMeds = new TreeSet<Med>();

    public Dep(String num) {
        this.num = num;
    }

    public Collection<Med> getLesMeds() {
        return lesMeds;
    }
    
    
    public Collection<Med> getLesMedsParNom(String nom) {
        Collection<Med> MedParNom = new HashSet<Med>();
        for(Med unMed : lesMeds) {
            
            if (unMed.getNom().startsWith(nom)) {
                MedParNom.add(unMed);
            }
        }
        return MedParNom;
    }
    
    public void addUnMed (Med unMed) {
        this.lesMeds.add(unMed);
    }
    public String getNum() {
        return num;
    }
    
    @Override
    public int compareTo(Dep t) {
        
        return num.compareTo(t.num);
    }
     
     
    
    
}
